﻿using Lingmeng.EntityFrameworkCore.MySql;
using Microsoft.Extensions.DependencyInjection;
using Video.Domain.UserRepository;
using Video.Domain.VideoRepository;
using Video.EntityFrameworkCore.Users;
using Video.EntityFrameworkCore.Videos;

namespace Video.EntityFrameworkCore
{
    public static class VideoEntityFrameworkCoreExtension
    {
        //注入efcore
        public static IServiceCollection AddVideoEntityFrameworkCore(this IServiceCollection services)
        {
            services.AddMySqlEntityFrameworkCore<VideoDbContext>("Default");
            services.AddTransient<IUserInfoRepository, UserInfoRepository>();
            services.AddTransient<IVideoRepository, VideoRepository>();
            services.AddTransient<IRoleRepository, RoleRepository>();
            return services;
        }
    }
}
